<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>豪康金服客服系统</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <link rel="stylesheet" href="statics/css/bootstrap.min.css">
  <link rel="stylesheet" href="statics/css/font-awesome.min.css">
  <link rel="stylesheet" href="statics/css/AdminLTE.min.css">
  <!-- AdminLTE Skins. Choose a skin from the css/skins
       folder instead of downloading all of them to reduce the load. -->
  <link rel="stylesheet" href="statics/css/all-skins.min.css">
  <link rel="stylesheet" href="statics/css/main.css">
  <link rel="shortcut icon" href="statics/img/favicon.png" />
  <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->
</head>
<style  type="text/css">
  .containerw{
    width: 970px !important;
  }
.body-bgw{
    width: 100%;
    height: 999px;
    position: fixed;
    left: 0;
    top: 0;
    z-index: -1;
    opacity: 0.3;
    background: linear-gradient(0deg, #23A899, #605DB3);
  }
  .bodyw{
    font-family: "华文细黑";
    width: 100%;
    height:100%;
   
    background-size: 100%;
    background: url(statics/img/bg.png) 0 0 no-repeat;
  }
  .loginw{
    background: url(statics/img/imac.png) 0 0 no-repeat;
    background-size: 940px 778px;
    color: #ffffff;
    margin-bottom: 20px;
    padding: 38px 38px 267px;
    padding-top: 38px;
    padding-right: 38px;
    padding-bottom: 267px;
    padding-left: 38px;
    position: relative;
  }
  .login-green{
    background-color: #1abc9c;
    min-height: 473px;
    padding:123px 100px 30px 450px;
  }
  .login-form{
    background-color: #edeff1;
    padding: 24px 10px 20px;
    position: relative;
    border-radius: 6px;
  }
  .login-form .login-field{
    /* border-color: transparent; */
    font-size: 17px;
    text-indent: 3px;
  }
  .login-icon{
    left: 200px;
    position: absolute;
    top: 200px;
    width: 100px;
  }
  .login-icon > img{
    display: block;
    margin-bottom: 6px;
    width: 200%;
  }
  .login-icon > h4 {
    font-size: 17px;
    font-weight: 300;
    line-height: 34px;
    opacity: .95;
  }
  .login-icon > h4 small {
    color: inherit;
    display: block;
    font-size: inherit;
    font-weight: 700;
  }
</style>
<body class="bodyw">
<div class="login-box" id="rrapp" v-cloak @keyup.enter ="login">
  <div class="containerw">
  <div class="body-bgw"></div>
  <div class="loginw">
    <div class="login-green">
      <div class="login-icon">
        <img src="statics/img/logo_hk.png" title="Welcome to chinazy" />
        <h5>
          Welcome to<br>豪康金服客服系统
        </h5>
      </div>
      <form class="login-form" ng-submit="login()">
        <div v-if="error" class="alert alert-danger alert-dismissible">
          <h4 style="margin-bottom: 0px;"><i class="fa fa-exclamation-triangle"></i> {{errorMsg}}</h4>
        </div>
        <div class="form-group has-feedback">
          <input type="text" class="form-control" v-model="username" placeholder="账号">
          <span class="glyphicon glyphicon-user form-control-feedback"></span>
        </div>
        <div class="form-group has-feedback">
          <input type="password" class="form-control" v-model="password" placeholder="密码">
          <span class="glyphicon glyphicon-lock form-control-feedback"></span>
        </div>
        <!--<div class="form-group has-feedback">
          <input type="text" class="form-control" v-model="captcha" @keyup.enter="login" placeholder="验证码">
          <span class="glyphicon glyphicon-warning-sign form-control-feedback"></span>
        </div>
        <div class="form-group has-feedback">
          <img alt="如果看不清楚，请单击图片刷新！" class="pointer" :src="src" @click="refreshCode">
          &nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:;" @click="refreshCode">点击刷新</a>
        </div>-->


        <div class="form-group has-feedback">
            <button type="button" style="background-color: #7266ba" class="btn btn-primary btn-block btn-flat" @click="login">登录</button>
        </div>
      </form>
    </div>
  </div>
  </div>



  <!--<div class="login-logo">
    <b>综合管理系统</b>
  </div>
  &lt;!&ndash; /.login-logo &ndash;&gt;
  <div class="login-box-body">
      <p class="login-box-msg">管理员登录</p>
      <div v-if="error" class="alert alert-danger alert-dismissible">
        <h4 style="margin-bottom: 0px;"><i class="fa fa-exclamation-triangle"></i> {{errorMsg}}</h4>
      </div>
      <div class="form-group has-feedback">
        <input type="text" class="form-control" v-model="username" placeholder="账号">
        <span class="glyphicon glyphicon-user form-control-feedback"></span>
      </div>
      <div class="form-group has-feedback">
        <input type="password" class="form-control" v-model="password" placeholder="密码">
        <span class="glyphicon glyphicon-lock form-control-feedback"></span>
      </div>
      &lt;!&ndash;<div class="form-group has-feedback">
        <input type="text" class="form-control" v-model="captcha" @keyup.enter="login" placeholder="验证码">
        <span class="glyphicon glyphicon-warning-sign form-control-feedback"></span>
      </div>
      <div class="form-group has-feedback">
        <img alt="如果看不清楚，请单击图片刷新！" class="pointer" :src="src" @click="refreshCode">
        &nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:;" @click="refreshCode">点击刷新</a>
      </div>&ndash;&gt;
      
      
      <div class="row">
        <div class="col-xs-8">
          <div class="checkbox icheck">
          </div>
        </div>
        &lt;!&ndash; /.col &ndash;&gt;
        <div class="col-xs-4">
          <button type="button" class="btn btn-primary btn-block btn-flat" @click="login">登录</button>
        </div>
        &lt;!&ndash; /.col &ndash;&gt;
      </div>
    &lt;!&ndash; /.social-auth-links &ndash;&gt;

  </div>
   /.login-box-body -->




</div>
<!-- /.login-box -->
<script src="statics/libs/jquery.min.js"></script>
<script src="statics/libs/vue.min.js"></script>
<script src="statics/libs/bootstrap.min.js"></script>
<script src="statics/libs/jquery.slimscroll.min.js"></script>
<script src="statics/libs/fastclick.min.js"></script>
<script src="statics/libs/app.js"></script>
<script type="text/javascript">
var vm = new Vue({
	el:'#rrapp',
	data:{
		username: '',
		password: '',
		captcha: '',
		error: false,
		errorMsg: '',
		src: 'captcha.jpg'
	},
	beforeCreate: function(){
		if(self != top){
			top.location.href = self.location.href;
		}
	},
	methods: {
		refreshCode: function(){
			this.src = "captcha.jpg?t=" + $.now();
		},
		login: function (event) {
			var data = "username="+vm.username+"&password="+vm.password;
			$.ajax({
				type: "POST",
			    url: "sys/login",
			    data: data,
			    dataType: "json",
			    success: function(result){
					if(result.code == 0){//登录成功
                     $.ajax({
                         type:"GET",
                         url:"sys/config/all2Cache",
                         data:null,
                         dataType:"json",
                         success:function (r) {
                            if(r.code == 0){
                                sessionStorage.setItem('platforms', JSON.stringify(r.platforms));
                                sessionStorage.setItem('configs', JSON.stringify(r.configs));
                                sessionStorage.setItem('userInfo', JSON.stringify(r.userInfo));
                                console.log(2);
                            //    var str = JSON.parse(sessionStorage.getItem('platforms'));
                                parent.location.href ='index.html';
                            }
                         }
                       });

					}else{
						vm.error = true;
						vm.errorMsg = result.msg;

						vm.refreshCode();
					}
				}
			});
		}
	}
});
</script>